﻿package Cain
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	import gs.TweenMax;
	/**
	 * ...
	 * @author cain@ 2009
	 */
	public class all_mk extends Sprite 
	{
		private var mc:DisplayObject;
		private var color:uint;
		private var alpa:Number;
		private var _t:Number;
		private var _a:Number;
		public function all_mk(_mc:DisplayObject,_color:uint = 0xffffff,_alpha:Number=0,a:Number=.5,t:Number=1) 
		{
			mc = _mc;
			color = _color;
			alpa = _alpha;
			_t = t;
			_a = a;
			init();
		}
		
		private function init():void
		{
			Sprite(mc.root).addChild(this);
			alpha = 0;
			TweenMax.to(this,_t,{alpha:_a});
			stage.addEventListener(Event.RESIZE, re_size);
			graphics.beginFill(color, alpa);
			graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
			re_size();
		}
		public function re_size(e:Event = null):void 
		{
			this.width = stage.stageWidth;
			this.height = stage.stageHeight;
		}
		public function unload(_t2:Number = 1):void 
		{
			TweenMax.to(this,_t2,{alpha:0,onComplete:remove});
		}
		private function remove():void 
		{
			Sprite(parent).removeChild(this);
		}
	}
	
}